var t = getApp();

Page({
    data: {
        showButton1: !1,
        showButton2: !0,
        showButton3: !0,
        showButton4: !0,
        store: {},
        vipCard: [],
        timeCard: [],
        limitCard: [],
        ecnoCard: [],
        curCard: [],
        baseUrl: t.globalData.baseUrl
    },
    showbutton1: function() {
        this.setData({
            showButton4: !0,
            showButton1: !1,
            showButton2: !0,
            showButton3: !0
        });
    },
    showbutton2: function() {
        this.setData({
            showButton4: !0,
            showButton1: !0,
            showButton2: !1,
            showButton3: !0
        });
    },
    showbutton3: function() {
        this.setData({
            showButton4: !0,
            showButton1: !0,
            showButton2: !0,
            showButton3: !1
        });
    },
    showbutton4: function() {
        this.setData({
            showButton4: !1,
            showButton1: !0,
            showButton2: !0,
            showButton3: !0
        });
    },
    cStore: function() {
        wx.navigateTo({
            url: "../storeList/storeList?page=hy"
        });
    },
    onLoad: function(t) {},
    getinitData: function(o) {
        var a = this;
        wx.request({
            url: o,
            data: {
                storeId: t.globalData.storeId,
                lng: t.globalData.lng,
                lat: t.globalData.lat
            },
            method: "POST",
            header: {
                "content-type": "application/x-www-form-urlencoded"
            },
            success: function(o) {
                var n = JSON.parse(o.data);
                0 != n.code ? wx.showToast({
                    title: n.msg,
                    icon: "none",
                    duration: 2e3
                }) : (a.setData({
                    store: n.store,
                    ekId: n.store.ekId
                }), wx.request({
                    url: t.globalData.urlStoreRechargr,
                    data: {
                        storeId: a.data.ekId
                    },
                    method: "POST",
                    header: {
                        "content-type": "application/x-www-form-urlencoded"
                    },
                    success: function(t) {
                        var o = JSON.parse(t.data);
                        if (0 != o.code) wx.showToast({
                            title: o.msg,
                            icon: "none",
                            duration: 2e3
                        }); else {
                            for (var n = [], e = [], s = 0; s < o.data.length; s++) 1 == o.data[s].type && n.push(o.data[s]), 
                            2 == o.data[s].type && e.push(o.data[s]);
                            a.setData({
                                yekcard: n,
                                jckcard: e
                            });
                        }
                    }
                }));
            }
        });
    },
    onReady: function() {},
    onShow: function() {
        var o = t.globalData.baseUrl + t.globalData.urlRechargrList;
        this.getinitData(o);
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    openMap: function() {
        var t = this;
        wx.openLocation({
            latitude: parseFloat(t.data.store.lat),
            longitude: parseFloat(t.data.store.lng),
            name: t.data.store.name,
            address: t.data.store.address
        });
    },
    buy: function(t) {
        var o = t.currentTarget.dataset.id, a = t.currentTarget.dataset.type;
        wx.navigateTo({
            url: "../huiyuan/detail?id=" + o + "&type=" + a
        });
    }
});